package com.sec.etech.employeesync.util;

public interface ConfigTableHandler<T> {
    Long getOrCreateConfigId(String... params);

    T getEntityByName(String name);

    String generateNextCode();

    void insertEntity(T entity);

    default String generateNextCode(String lastCode) {
        int codeNumber = Integer.parseInt(lastCode);
        codeNumber++;
        return codeNumber < 100 ? String.format("%02d", codeNumber) : String.valueOf(codeNumber);
    }

    default String generateNextSerialNumber(String lastCode) {
        int codeNumber = Integer.parseInt(lastCode);
        codeNumber++;
        return String.valueOf(codeNumber);
    }
}
